package com.sensePlusVR.widget.dialog;

import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.sensePlusVR.base.BaseDialog;
import com.sensePlusVR.bean.ActorItem;
import com.sensePlusVR.db.ImageLibrary;
import com.sensePlusVR.db.ImageLibrary.Callback;
import com.sensePlusVR.main.R;
import com.sensePlusVR.utils.MyDialogUtil;
import com.sensePlusVR.utils.MyLog;

public class FullScreenImgeDialog extends BaseDialog implements OnClickListener{
	private static final String TAG = FullScreenImgeDialog.class.getSimpleName();
	private Context context;
	private ActorItem actorItem;
	private ImageView zoom_iv;
	
	public FullScreenImgeDialog(Context context,ActorItem actorItem) {
		super(context,R.style.FullScreen_Dialog_Half_Tran);
		this.context = context;
		this.actorItem = actorItem;
		init();
	}

	private void init() {}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dialog_imageview_fullscreen);
		zoom_iv = (ImageView) findViewById(R.id.zoom_iv);
		
		zoom_iv.setOnClickListener(this);
		
		initData();
	}
	
	private void initData() {
		String imageUrl = actorItem.getImgurl();
		ImageLibrary.getInstance().getImageBitmap(context, imageUrl, new Callback() {
			@Override
			public void onImageDownloaded(Bitmap bitmap,String imageUrl) {
				MyLog.d(TAG, "bitmap : " + bitmap);
				if (bitmap != null){
					zoom_iv.setImageBitmap(bitmap);
				}
			}
		});
		
		
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.zoom_iv:
			MyLog.d(TAG, "zoom_relative click");
			dismiss();
			break;
		}
	}
	
	
	@Override
	public void show() {
		super.show();
		MyDialogUtil.setDialogFullScreen(context, this);
	}

}
